package com.cyx;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author 陈裕星
 * @version 1.0
 */
public class 最小距离 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        /*暴力超时可以优化
            Arrays.sort(arr);
            int min = arr[1] - arr[0];
            for (int i = 1; i < n; i++) {
                for (int j = i + 1; j< n; j++){
                    min = Math.min(arr[j]-arr[i],min);
                }
            }
            System.out.println(min);
        */
    }
}
